package  
{
	import flash.events.MouseEvent;
	import flash.text.TextField;
	/**
	 * ...
	 * @author patsup
	 * 
	 * *** protected functions
	 * InitImage
	 * InputMouseClick
	 */
	public class StartMenuBtn extends Button 
	{
		private var inputFunc:Function;							//function to call on mouseclick
		
		//new button image parameters
		private const BTN_COLOR:int = 0xFF8000;
		private const BTN_WIDTH:int = 120;
		private const BTN_HEIGHT:int = 40;
		private var btnLabel:TextField;							//button label
		
		private var buttonText:String;							//for InitImage()
		
		public function StartMenuBtn(xCoord:int, yCoord:int, btnTxt:String, inputFunc:Function)
		{
			name = btnTxt + " Button";
			btnLabel = new TextField();
			buttonText = btnTxt;
			
			this.inputFunc = inputFunc;
			
			InitInput();
			InitImage();
			
			super(xCoord, yCoord);
		}
		
		//InitImage()
		//Initializes the image of the StartMenuBtn
		protected override function InitImage():void
		{
			graphics.beginFill(BTN_COLOR);
			graphics.drawRect(0, 0, BTN_WIDTH, BTN_HEIGHT);
			graphics.endFill();
			
			btnLabel.text = buttonText;
			btnLabel.width = btnLabel.textWidth*1.2;			//reduce the textfield's dimensions so they don't inflate the stage
			btnLabel.height = btnLabel.textHeight*1.5;
			btnLabel.x = 0.5 * BTN_WIDTH - 0.5 * btnLabel.width;
			btnLabel.y = 0.5 * BTN_HEIGHT - 0.5 * btnLabel.height;
			addChild(btnLabel);								//now add this txt label to the display list
			
			super.InitImage();
		}
		
		//InputMouseClick()
		//Takes action for StartMenuButton upon hearing the mouseclick event
		protected override function InputMouseClick(e:MouseEvent):void
		{
			inputFunc();
			
			super.InputMouseClick(e);
		}		
	}

}